{include file='public/meta' /}

<title>添加管理员 - 管理员管理 - H-ui.admin v3.0</title>
</head>
<body>
<article class="cl pd-20" style="height: 100px">
	<form action="" method="post" class="form form-horizontal" id="form-admin-add">

        <div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>厂家名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
                <select id="oem" name="oem" aria-controls="DataTables_Table_0" class="select">
                    <option value="">---请选择厂家---</option>
                    {volist name="list" id="vo"}
                    <option value="{$vo.id}">{$vo.name}</option>
                    {/volist}
                </select>
				<!-- <input type="hidden" class="input-text" value="" placeholder="" id="oem" name="pid"> -->
			</div>
		</div>
        
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>品牌名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="brand" name="brand">
            </div>
        </div>
		
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;" id="submit">
				<font id = "mes" style="position:relative; left: 50px;"></font>
			</div>
		</div>
	</form>
</article>

{include file="public/footer" /}
<script type="text/javascript">

$(function(){

	$("#brand").blur(function(){
            $.ajax({
                type: 'GET',
                url: "checkBrandName",
               	data:{name:$(this).val()},
                dataType: 'json',
                success: function(data){
                    $("#mes").text(data.message);
                }
            });
        });
    
    
    $("#submit").click(function(){
        $.ajax({
            type: "POST",
            url: "{:url('car/addBrand')}",
            data: $("#form-admin-add").serialize(),
            dataType: "json",
            success: function(data){
                alert(data.message);
                if (data.status == 1) {
                    layer.close(layer.index);
                    parent.location.reload(); // 父页面刷新
                }
            }
        });
    });
	
});
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>